home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 051-075 / disk_065 / cookie / cookie.doc < prev    next >
Text File  |  1992-05-06  |  3KB  |  64 lines

  1.               "Cookie" - The Fortune Cookie Program
  2.  
  3.               User's and Developer's Guide
  4.  
  5.           Copyright (C) 1987, Richard P. Stevens, II and
  6.          Small Scale Systems of Southern California (4SC)
  7.  
  8. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  9. "COOKIE" is a fun program. Used primarily as an amusement, Cookie will produce
  10. a daily (hourly, minutely?) dose of wisdom and sage advice.
  11.  
  12. The program is provided to the public domain by the author of both the program
  13. and this guide, Rick Stevens.
  14.  
  15. The executable program image, "Cookie", may reside in any directory. The 
  16. data file, "Cookie.Dat", must reside in the ":devs/" directory -- that is
  17. the current disk, in the "DEVS" directory.
  18.  
  19. [Ed note:  I've modified the program to use the logical assign COOKIE: so
  20.  you can just assign COOKIE: to whatever directory the cookie.dat file
  21.  is in.  Fred Fish, 4-Apr-87]
  22.  
  23. The program will compute a random number, using a seed value of the second
  24. longword returned by the "DateStamp()" function in AmigaDOS. This random
  25. number (returned as a longword), is then divided by the length of the
  26. "Cookie.Dat" file (returned by the AmigaDOS "LIST" command) in bytes (used
  27. as a compile-time constant).
  28.  
  29. The resultant value is then used to seek to a random spot in that data file.
  30. The data file is read until an ASCII "form feed" character is read (a
  31. hexadecimal value of "0x0C"). This signifies the beginning of a fortune.
  32.  
  33. The file is then read into another buffer, up to the next form feed character.
  34. The form feed character is replaced by a NULL, and the fortune is printed to
  35. the screen.
  36.  
  37. If, at any time during the above operations, a file error occurs, a new random
  38. number is generated and the process repeats. A CONTROL-C or CONTROL-D character
  39. from the keyboard will abort the program at any time.
  40.  
  41. The structure of the "Cookie.Dat" file is as follows:
  42.  
  43.     A form feed character is the first character.
  44.     2.    A string of ASCII characters which form the text of the
  45.         fortune. The text may span multiple lines.
  46.     3.    A form feed character terminates the fortune.
  47.  
  48. The file, as distributed, was downloaded from a VAX-11/750 computer from
  49. Digital Equipment Corporation. The origins of the file are unknown to the
  50. author, but probably came from the DEC Users Society (DECUS).
  51.  
  52. The fortunes are in alphabetical order, but that is not necessary.
  53.  
  54. The author hopes that you will enjoy this program. Feedback is quite welcome.
  55.  
  56. Address your letters to:
  57.  
  58.     Rick Stevens
  59.     Small Scale Systems of Southern California (4SC)
  60.     10447-1 Larwin Avenue
  61.     Chatsworth, CA  91311
  62.     (818) 882-2015
  63.  
  64.